from tkinter import *
import hashlib
root = Tk()
text = Text(root,width=20,height=5,undo=True)
text.pack()
text.insert(INSERT,"I love Python3.x")
def show():
    text.edit_undo()#撤销
def show1():
    text.edit_redo()#恢复
Button(root,text="撤销",command=show).pack()
Button(root,text="撤销",command=show1).pack()
mainloop()